package com.china.great.system.service.impl;

import com.china.great.system.dao.BlogMapper;
import com.china.great.system.entity.Blog;
import com.china.great.system.entity.SystemUser;
import com.china.great.system.service.BlogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Liu HongYang
 * @DateTime: 2020/5/8 9:40 下午
 * @Description: TODO
 */
@Service
public class BlogServiceImpl implements BlogService {
    @Autowired
    private BlogMapper blogMapper;

    @Override
    public PageInfo getList(int pageSize, int pageNum) {
        PageHelper.startPage(pageNum,10);
        List<Blog> list = blogMapper.getList(pageNum,pageNum);
        PageInfo pageInfo = new PageInfo(list);
        return pageInfo;
    }

    @Override
    public int insert(Blog blog) {
        return blogMapper.insert(blog);
    }

    @Override
    public int update(Blog blog) {
        return blogMapper.update(blog);
    }

    @Override
    public int delete(int id) {
        return blogMapper.delete(id);
    }
}
